package com.bw.springboot.starter.upload;


import com.bw.springboot.starter.upload.service.FileService;
import com.bw.springboot.starter.upload.util.FileProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Administrator
 */
@Configuration
@EnableConfigurationProperties(FileProperties.class)
public class FileServiceAutoConfigurationProperties {

    @Autowired
    private FileProperties fileProperties;

    @Bean
    @ConditionalOnProperty(prefix = "file",value = "enable",havingValue = "true")
    public FileService fileService(){
        return new FileService(fileProperties);
    }

}
